package org.benjamin.lending.trusteeship.sumapay;

import org.benjamin.lending.domain.entity.BorrowInfo;
import org.benjamin.lending.domain.entity.MemberInfo;
import org.benjamin.lending.domain.entity.TrusteeshipRequest;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Created by xywenjie on 2017/5/26.
 */
@Component("sumapayAccountManagerOperation")
public class AccountManagerOperation extends SumapayAbstractOperation {
    @Override
    protected void processRequest(Map<String, Object> requestMap, MemberInfo memberInfo, BorrowInfo borrowInfo,Map<String, Object> parameterMap) {
        this.abutmentUrl = sumaplayConfig.getServiceName()+"/user/accountManager_toAccountManager";
    }

    /**
     * 打开账户管理功能不需要同步返回页面链接
     * @param requestMap
     */
    @Override
    protected void buildAbutmentUrl(Map<String, Object> requestMap) {
        //super.buildAbutmentUrl(requestMap);
    }

    @Override
    protected String signatureRequest(Map<String, Object> requestMap) {
        String[] signatures = this.buildSignature(requestMap,"requestId","merchantCode","userIdIdentity");
        requestMap.put("signature",signatures[1]);
        return signatures[0];
    }

    @Override
    protected void afterRequest(Map<String, Object> parameterMap, MemberInfo memberInfo,BorrowInfo borrowInfo, TrusteeshipRequest trusteeshipRequest) {

    }

    @Override
    protected String[] signatureResponse(Map<String, Object> responseMap) {
        return new String[0];
    }
}
